package com.hqully.smartfumehood.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hqully.smartfumehood.common.vo.QueryVo;
import com.hqully.smartfumehood.entity.AirData;
import com.hqully.smartfumehood.service.AirDataService;
import com.hqully.smartfumehood.mapper.AirDataMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
* @author ZH.ming
* @description 针对表【air_data】的数据库操作Service实现
* @createDate 2022-06-24 10:30:48
*/
@Service
public class AirDataServiceImpl extends ServiceImpl<AirDataMapper, AirData>
    implements AirDataService{

    @Autowired
    private AirDataMapper airdataMapper;

    @Override
    public int addAirData(AirData airData) {
        return airdataMapper.addAirData(airData);
    }

    @Override
    public PageInfo<AirData> findAllAirDataByAPIdAndAirId(QueryVo queryVo) {
        PageHelper.startPage(queryVo.getPageNum(),queryVo.getPageSize(),true);

        List<AirData> airDataList = airdataMapper.findAllAirDataByAPIdAndAirId(queryVo.getQuery());

        PageInfo<AirData> airDataPageInfo = new PageInfo<>(airDataList);
        return airDataPageInfo;
    }

    @Override
    public PageInfo<AirData> findAllAirDataByAirId(QueryVo queryVo) {
        PageHelper.startPage(queryVo.getPageNum(),queryVo.getPageSize(),true);

        List<AirData> airDataList = airdataMapper.findAllAirDataByAirId(queryVo.getQuery());

        PageInfo<AirData> airDataPageInfo = new PageInfo<>(airDataList);
        return airDataPageInfo;
    }

}





